/* This module defines functions to manipulate character strings */

#ifndef STRING_H
#define STRING_H

#include "types.h"

/* returns the length of the string s */
int32_t strlen(const char* s);

/* copy up to n characters from source to destination and returns a pointer to destination */
char* strncpy(char* destination, const char* source, uint32_t n);


/* compare two strings and returns:
   a positive number if s1 > s2
   0 if s1 == s2
   a negative number if s1 < s2 
*/
int32_t strcmp(const char* s1, const char* s2);

/* concatenate s1 and s2 (at most n characters from s2 can be appended to s1). Returns a pointer to s1 */
char* strncat(char* s1, const char* s2, uint32_t n);

/* converts value into a character string and stores it into string (up to n-1 characters). At the end, string is a null terminated character string. Returns also a pointer to string. */
char* itoa(int32_t value, char* string, uint32_t n);

/* converts string into a signed int and returns it. Returns 0 if string is not a number. */
int32_t atoi(const char* string);

#endif
